package my.mybatis.common;

import lombok.ToString;

import java.io.Serializable;

/**
 * @Author:wangbin.
 * @Description.
 * @Date:Created in 14:57 2018/1/15.
 * @Modified By:
 */
@ToString
public class LimitParam implements Serializable{
    private static final long serialVersionUID = 1603702372774000917L;
    // 初始偏移位置
    private int offset;
    // 要获取的数据量
    private int rows;
    private static final String limit = " limit ";

    public LimitParam(int offset, int rows) {
        this.offset = offset;
        this.rows = rows;
    }

    public int getOffset() {
        return offset;
    }

    public void setOffset(int offset) {
        this.offset = offset;
    }

    public int getRows() {
        return rows;
    }

    public void setRows(int rows) {
        this.rows = rows;
    }

    public String getLimitSql()
    {
        String limitSql = limit + offset + "," + rows;
        return limitSql;
    }
}
